﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hash
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue queue0 = new Queue();
            Queue queue1 = new Queue(30);
            Queue queue2 = new Queue(30, 2);
            Queue queue3 = new Queue(queue0);
            //添加元素到结尾处
            queue0.Enqueue("郝帅");
            queue0.Enqueue("掉i帅");
            queue0.Enqueue("彪帅");
            queue0.Enqueue("飑帅");
            //循环放出元素并移除
            while (queue0.Count != 0) {
                Console.WriteLine(queue0.Dequeue() + "以移除");
            }
            Console.Read();
            //复制队列元素到新队列
            queue1.Enqueue("郝2帅");
            queue1.Enqueue("掉i31帅");
            queue1.Enqueue("彪帅12");
            queue1.Enqueue("飑帅54");
            queue1.Enqueue(queue0);
            object[] fgl = queue1.ToArray();
            while (fgl.Length != 0)
            {
                Console.WriteLine(queue1.Dequeue() + "以移除");
            }

            // GetEnumerator循环
            IEnumerator enumerator = queue1.GetEnumerator();
            while (enumerator.MoveNext()) {
                Console.WriteLine(enumerator.Current + "以移除");

            }
            //stack
            Stack stack0 = new Stack();
            //向栈中存放元素
            stack0.Push("1 号盘子");
            stack0.Push("2 号盘子");
            stack0.Push("3 号盘子");
            stack0.Push("4 号盘子");
            stack0.Push("5 号盘子");
            Console.WriteLine("取出盘子：");
            //判断栈中是否有元素
            while (stack0.Count != 0)
            {
                //取出栈中的元素并删除头部元素
                Console.WriteLine(stack0.Pop());
            }
            //Hashtable
            Hashtable ht0 = new Hashtable();
            ht0.Add(0, "上天");
            ht0.Add(1, "入地");
            ht0.Add(2, "潜水");
            Console.WriteLine("你想干什么");

            int dt = int.Parse(Console.ReadLine());
            bool flag = ht0.ContainsKey(dt);
            if (flag)
            {
                Console.WriteLine("你有能力去做{}", ht0[dt].ToString());

            }
            else {
                Console.WriteLine("能不能别闹你不能{0}", ht0[dt].ToString());
            }

            Console.WriteLine("你可知道，你能做到的有：");
            foreach (DictionaryEntry t in ht0 ) {
                int key = (int)t.Key;
                string add = t.Value.ToString();
                Console.WriteLine("能力{0}{1}",key,add);
            }





        }
    }
}
